/**
 * 后退按钮 指令控制
 */
define(['angular'], function (angular) {
    "use strict";
    var directive = function ($state, CommonService) {
        return {
            restrict: "E",
            replace: true,
            template: '<a class="button button-icon icon ion-ios-close-empty" style="position: absolute; left: 40px; top: 3px" ng-click="close()"></a>',
            link: function (scope) {
                if (!scope.close) {
                    scope.close = function () {
                        CommonService.showConfirm({message: '确定要退出开户吗？'}, function () {

                        }, function () {
                            $state.go('tab.account-index');
                        })
                    }
                }
            }
        }
    };
    directive.$inject = ['$state', 'CommonService'];
    return directive;
});